home *** CD-ROM | disk | FTP | other *** search
- //: C03:AutoIncrement.cpp
- // From Thinking in C++, 2nd Edition
- // Available at http://www.BruceEckel.com
- // (c) Bruce Eckel 1999
- // Copyright notice in Copyright.txt
- // Shows use of auto-increment
- // and auto-decrement operators.
- #include <iostream>
- using namespace std;
-
- int main() {
- int i = 0;
- int j = 0;
- cout << ++i << endl; // Pre-increment
- cout << j++ << endl; // Post-increment
- cout << --i << endl; // Pre-decrement
- cout << j-- << endl; // Post decrement
- } ///:~
-